//
//  GameMaster.h
//  DiceWar
//
//  Created by xiaofeng on 27/6/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#ifndef CLASSES_GAME_GAMEPLAY_GAMEMASTER_H_
#define CLASSES_GAME_GAMEPLAY_GAMEMASTER_H_

#include "HexMap.h"
#include "HexMapLayer.h"
#include "RetainGuard.h"

class m_pHexMapLayer;
class GameMaster
{
public:
    GameMaster();
    ~GameMaster();
    
    enum GameMode
    {
        kPeopleVsPeople,
        kPeopleVsAI,
        kInvalidMode
    };
    
private:
    GameMaster(const GameMaster& other);
    GameMaster& operator=(const GameMaster& other);
    
public:
    static GameMaster& instance();
    
    bool init();
    void generateNextMap();
    
    HexMap* getHexMapPtr() { return &m_hexMap; }
    
    HexMap& getHexMap() { return m_hexMap; }
    const HexMap& getHexMap() const { return m_hexMap; }
    
    bool isPeopleVsPeople() const { return m_gameMode == kPeopleVsPeople; }
    bool isPeopleVsAI() const { return m_gameMode == kPeopleVsAI; }

    void setGameMode(GameMode gameMode);
    GameMode getGameMode() const { return m_gameMode; }

    void setNumPlayers(int numPlayers);
    int getNumPlayers() const { return m_numPlayers; }
    
    void setMaxNumPlayers(int numPlayers);
    int getMaxNumPlayers() const {return m_maxNumPlayers; }
    
    void setHumanPlayerType(PlayerType type);
    PlayerType getHumanPlayerType() const { return m_humanType; }
    
private:
    HexMap m_hexMap;
    GameMode m_gameMode;
    int m_numPlayers;
    int m_maxNumPlayers;
    
    PlayerType m_humanType;
};

#endif //CLASSES_GAME_GAMEPLAY_GAMEMASTER_H_
